<?php
/**
 * Created by PhpStorm.
 * User: meiyun1
 * Date: 2017/2/23
 * Time: 下午4:20
 */

namespace App\Models\ActivityModelTemplate;

use App\Contracts\Repositories\ActivityModelTemplateRepository as ActivityModelTemplate;
use App\Models\ActivityModel\ActivityModel;

class ActivityModelTemplateService
{
    private $activityModelTemplate;

    public function __construct(ActivityModelTemplate $activityModelTemplate)
    {
        $this->activityModelTemplate = $activityModelTemplate;
    }

    public function create($data)
    {
        $modelTpl = new \App\Models\ActivityModelTemplate\ActivityModelTemplate($data);
        return $this->activityModelTemplate->create($modelTpl);
    }

    /**
     * @param string $model_id
     * @return ActivityModel
     */
    public function findByModel($model_id="")
    {
        return $this->activityModelTemplate->findByModel($model_id);
    }

    /**
     * @param $id
     * @return \App\Models\ActivityModelTemplate\ActivityModelTemplate
     */
    public function findOne($id)
    {
        return $this->activityModelTemplate->findOne($id);
    }
}
